def input_password():
    pwd = input("请输入密码\n")

    if len(pwd) >= 8:
        return pwd
    raise Exception("密码长度必须大于等于8位！") #主动触发异常


if __name__ == '__main__':
    try:
        print(input_password())
    except Exception as e:
        print(e)

